package com.zx.designpattern.utils;

import android.support.annotation.StringRes;
import android.widget.Toast;

import com.zx.designpattern.BaseApplication;



/**
 * @作者 Administrator
 * @创建时间 2018/3/10
 * @描述 ToastUtils
 * @修改时间 2018/3/10
 * @修改描述 ToastUtils
 * @修改者 Administrator
 **/
public class ToastUtils {

    private ToastUtils() {
    }

    public static void show(CharSequence text) {
        if (text.length() < 20) {
            Toast.makeText(BaseApplication.getInstance(), text, Toast.LENGTH_SHORT).show();
        } else {
            Toast.makeText(BaseApplication.getInstance(), text, Toast.LENGTH_LONG).show();
        }
    }

    public static void show(@StringRes int resId) {
        show(BaseApplication.getInstance().getString(resId));
    }

}